<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
?>
<?php 	
$db	= &JFactory::getDBO();
$q="SELECT introtext FROM #__content where id = 13";
$db->setQuery($q);
$temp=$db->loadObject();
$query = "INSERT #__users_pay(user_id, date, success) VALUES (".JRequest::getVar('userid').", '".date("Y-m-d H:i:s")."', 0)";
$db->setQuery($query);
$db->query();
$order_id = mysql_insert_id();
 ?>
<script type="text/javascript">
    $(document).ready(function(){
		$('#submitBtn').click(function(){
			if($('#aa').is(":checked"))
			{
				$("#leasingForm").submit();  
			}
			else{
			   check_out();
			}
		})      
    });
</script>
<!-- popup check jquery input  -->
<script type="text/javascript">
	$(document).ready(function(){
	
    check_out=function(){

       	$('#alert').html('De skal acceptere vores salgs- og leveringsbetingelser først.');
        $('#backoverlay').show();
        $('#show_popup').show();
    } 
    });

</script>  
<!-- div to display popup validate -->
<div style="display: none;position: fixed; top: 0;left: 0;width: 100%;height: 100%;background-color: #000000;z-index:10000;-moz-opacity: 0.8;opacity:.80;filter: alpha(opacity=80);" id="backoverlay"></div>

<div class="w739 float_right" id="checkout">
        <div class="tt  p5t">Registrering</div> 
           <div class="p5t">
               <div class="box_gude p10l p15t p30b">
         <p class="p10b"><?php echo $temp->introtext; ?></p><br />
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="boder">
          <tr>
            <td width="50%" class="tex_up p10">produkt</td>
            <td width="20%" class="tex_up p10 boder_l">Pris</td>
            <td width="30%" class="tex_up p10 boder_l">subtotal</td>
          </tr>
          <tr>
            <td class="boder_t p10">Live auktion depositum</td>
            <td class="boder_t p10 boder_l">DKK 3.000,-</td>
            <td class="boder_t p10 boder_l">DKK 3.000,-</td>
          </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="m10t">
  <tr>
    <td width="50%" rowspan="3" class="p10l"><input name="check" id="aa" type="checkbox" value="" />
    &nbsp;<a href="#TB_inline?height=350&width=700&inlineId=hiddenContent&modal=false" title="Handelsbetingelser" class="thickbox">Jeg har læst og accepteret auktionsbetingelser</a></td>
    
  </tr>
  <tr>
    <td align="right"class="p10r"><strong>Total at betale:</strong> </td>
    <td class="p10l"><strong>DKK 3.000,-</strong></td>
  </tr>
</table>
<p class="p15t"><a href="javascript:void(0);" id="submitBtn"><img src="templates/tpl_automobil/images/bt_aben.jpg"/></a></p>
        </div>
      </div>
      <div class="cb"></div>
  </div>
  

<?php
if(JRequest::getVar('active')) $active = "&active=1";
$protocol = '3';
$msgtype = 'authorize';
$merchant = '33163916';
$language = 'da';
$ordernumber = "0000".$order_id;
$amount = 3000*100;

$currency = 'DKK';
$continueurl = JURI::base().'index.php?option=com_user&task=success&userid='.JRequest::getVar('userid').$active;
$cancelurl = JURI::base().'index.php?option=com_user&task=error&userid='.JRequest::getVar('userid');
$callbackurl = JURI::base().'index.php?option=com_user&task=processReturn&userid='.JRequest::getVar('userid').'&orderid='.$order_id.$active;
                
$autocapture = '0';
$cardtypelock = 'dankort, danske-dk, mastercard, mastercard-dk, american-express, american-express-dk, diners, diners-dk, edankort, fbg1886, jcb, mastercard-debet-dk, nordea-dk, visa, visa-dk, visa-electron, visa-electron-dk';
$description = 'description';
$testmode = 0;
$splitpayment = 0;
$md5word = '1LDG6h84687QKv24Wcabg9Sr4H2B17yz3pC3IJA56s1ZVw69t7mjU8kdTP7E5q49';
$md5check = md5($protocol . $msgtype . $merchant . $language . $ordernumber . $amount . $currency . $continueurl . $cancelurl . $callbackurl . $autocapture . $cardtypelock . $description . $testmode. $splitpayment . $md5word);
?>


<form id="leasingForm" action="https://secure.quickpay.dk/form/" method="post">
    <input type="hidden" name="protocol" value="<?php echo $protocol ?>" />
    <input type="hidden" name="msgtype" value="<?php echo $msgtype ?>" />
    <input type="hidden" name="merchant" value="<?php echo $merchant ?>" />
    <input type="hidden" name="language" value="<?php echo $language ?>" />
    <input type="hidden" name="ordernumber" value="<?php echo $ordernumber ?>" />
    <input type="hidden" name="amount" value="<?php echo $amount ?>" />
    <input type="hidden" name="currency" value="<?php echo $currency ?>" />
    <input type="hidden" name="continueurl" value="<?php echo $continueurl ?>" />
    <input type="hidden" name="cancelurl" value="<?php echo $cancelurl ?>" />
    <input type="hidden" name="callbackurl" value="<?php echo $callbackurl ?>" />
    <input type="hidden" name="autocapture" value="<?php echo $autocapture ?>" />
    <input type="hidden" name="cardtypelock" value="<?php echo $cardtypelock ?>" />
    <input type="hidden" name="md5check" value="<?php echo $md5check ?>" />
	<input type="hidden" name="description" value="<?php echo $description ?>" />
	<input type="hidden" name="testmode" value="<?php echo $testmode ?>" />
	<input type="hidden" name="splitpayment" value="<?php echo $splitpayment ?>" />
    <!--<input type="submit" value="Open Quickpay payment window" />-->
</form>
<div id="hiddenContent" style="display:none;">
<?php 
$db	= &JFactory::getDBO();
$query = "SELECT introtext FROM #__content WHERE id = 6";
$db->setQuery($query);
$temp1=$db->loadObject();
 echo $temp1->introtext;
?>
</div>